#!/usr/bin/env python3

import sys

def run():
    raise KeyError("键名找不到..", 10)
    #  raise ValueError("值错误找不到..")
    #  raise IndexError("下标错误找不到..")
    #  raise NameError("名字错误找不到..")
    pass

def main():
    try:
        run()
    #  except KeyError:
        #  print("异常信息: ", sys.exc_info()[1])
    #  except KeyError as e:
        #  print("异常信息: ", e)
    except (KeyError, ValueError, IndexError) as e:
        print("异常信息: ", e)
        return
    except Exception as e:
        print("产生的异常前面代码无法捕捉执行异常处理代码块..")
        print("except Exception: ", e)
    except:
        print("产生的异常前面代码无法捕捉执行异常处理代码块..")
        print("except : ", sys.exc_info()[1])
    else:
        print("没有产生异常执行的代码块")
    finally:
        print("不管有没有产生异常都会执行代码块")

if __name__ == "__main__":
    main()
